package com.lbd.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.lbd.common.validate.AddGroup;
import com.lbd.common.validate.ListValue;
import com.lbd.common.validate.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * JSR303分组校验：
 * 	1. 给校验注解标注什么情况需要进行校验  @URL(message = "品牌logo地址必须为URL格式",groups = {AddGroup.class,UpdateGroup.class})
 * 	2. @Validated({AddGroup.class}
 * 	3. 默认没有指定分组的校验注解，在分组校验情况下不生效
 * @author linbd
 * @email 2236000738@qq.com
 * @date 2021-06-04 17:54:12
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@NotNull(groups = {UpdateGroup.class})
	@Null(groups = {AddGroup.class})
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名必须提交",groups = {AddGroup.class})
	private String name;
	/**
	 * 品牌logo地址   修改的时候可以为空，但是带上了URL则保证要合法
	 */
	@NotEmpty(groups = {AddGroup.class})
	@URL(message = "品牌logo地址必须为URL格式",groups = {AddGroup.class,UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@NotNull(groups = {AddGroup.class})
	@ListValue(vals = {0,1},groups = {AddGroup.class,UpdateGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotEmpty(groups = {AddGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$",message = "填入值必须为字母且不可超过一个字符",groups = {AddGroup.class,UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(groups = {AddGroup.class})
	@Min(message = "排序字段值必须大于0", value = 0,groups = {AddGroup.class,UpdateGroup.class})
	private Integer sort;

}
